#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int main()
{
	FILE* pin = fopen("data.txt", "r");
	if (pin == NULL)
	{
		perror("fopen 1");
		return 1;
	}

	FILE* pout = fopen("data_copy.txt", "w");
	if (pout == NULL)
	{
		perror("fopen 2");
		fclose(pout);
		return 1;
	}

	int ch = 0;
	while ((ch = fgetc(pin)) != EOF)
	{
		fputc(ch, pout);
	}

	fclose(pin);
	pin = NULL;
	fclose(pout);
	pout = NULL;
	return 0;
}